package com.leonzx.base.config.ureport.datasource;

import com.bstek.ureport.definition.datasource.BuildinDatasource;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

/**
 * @Author:梁亮
 * @Description:
 * @Date: 2018/7/4 14:30
 */
@Component
public class LeonDatasource implements BuildinDatasource {

    @Resource(name = "leonlims")
    private DataSource dataSource;

    @Override
    public String name() {
        return "默认数据源";
    }

    @Override
    public Connection getConnection() {
        try {
            return dataSource.getConnection();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
}
